import { useState } from 'react'

// 封装增删改查数据页面处理
export default function usePages(limit = 10, getTableData = () => {}) {
  const [searchForm, setSearchForm] = useState<Record<string, any>>({
    page: 1,
    limit
  })

  // 搜索table
  const handleSearchTable = () => {
    getTableData()
  }

  // 重置table
  const handleResetTable = () => {
    getTableData()
  }

  return {
    searchForm,
    handleSearchTable,
    handleResetTable
  }
}
